package com.ficus.road.maintain.core.model.density;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author xiawen yang
 * @date 2022/3/15 下午5:32
 */
@Data
@AllArgsConstructor
@Builder
@NoArgsConstructor
public class UnitDensityZH {

    private String projectid;

    private String length;

    private int count;

    private double rate;


    public UnitDensity convert2UnitDensity(UnitDensityZH zh, String date, String cycleNum) {
        return UnitDensity.builder()
                .id(zh.getProjectid() + date)
                .date(date)
                .unitId(zh.getProjectid())
                .density(zh.getRate())
                .cycleNum(cycleNum)
                .lastModificationTime(new Date())
                .count(zh.getCount())
                .build();
    }
}
